<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>

{% if groups['namenodes']|count > 1 %}
  <property>
    <name>dfs.nameservices</name>
    <value>{{ cluster_name }}</value>
  </property>

  <property>
    <name>dfs.ha.namenodes.{{ cluster_name }}</name>
    <value>{% for item in groups['namenodes'] -%}
              {{ item }}{% if not loop.last %},{% endif %}
           {%- endfor %}</value>
  </property>

{% for item in groups['namenodes'] %}
  <property>
    <name>dfs.namenode.rpc-address.{{ cluster_name }}.{{ item }}</name>
    <value>{{ item }}:8020</value>
  </property>

  <property>
    <name>dfs.namenode.http-address.{{ cluster_name }}.{{ item }}</name>
    <value>{{ item }}:50070</value>
  </property>

{% endfor %}
  <property>
    <name>dfs.namenode.shared.edits.dir</name>
    <value>qjournal://{% for item in groups['journalnodes'] -%}
             {{ item }}:8485{% if not loop.last %};{% endif %}
                      {%- endfor %}/{{ cluster_name }}</value>
  </property>

  <property>
    <name>dfs.journalnode.edits.dir</name>
    <value>{{ dfs_journalnode_edits_dir }}</value>
  </property>

  <property>
    <name>dfs.client.failover.proxy.provider.{{ cluster_name }}</name>
    <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
  </property>

  <property>
    <name>dfs.ha.fencing.methods</name>
    <value>sshfence</value>
  </property>

  <property>
    <name>dfs.ha.fencing.ssh.private-key-files</name>
    <value>/var/lib/hadoop-hdfs/.ssh/id_rsa</value>
  </property>

  <property>
    <name>dfs.ha.automatic-failover.enabled</name>
    <value>true</value>
  </property>
{% endif %}

  <property>
     <name>dfs.namenode.name.dir</name>
     <value>{{ dfs_namenode_name_dir }}</value>
  </property>

  <property>
     <name>dfs.datanode.data.dir</name>
     <value>{{ dfs_datanode_data_dir }}</value>
  </property>

  <property>
    <name>dfs.replication</name>
    <value>{{ dfs_replication }}</value>
  </property>

  <property>
    <name>dfs.permissions.superusergroup</name>
    <value>hadoop</value>
  </property>

  <property>
    <name>dfs.hosts.exclude</name>
    <value>/etc/hadoop/conf/dfs.exclude</value>
  </property>

  <property>
    <name>dfs.client.read.shortcircuit</name>
    <value>true</value>
  </property>

  <property>
    <name>dfs.domain.socket.path</name>
    <value>/var/run/hadoop-hdfs/hdfs.socket</value>
  </property>

  <property>
    <name>dfs.client.file-block-storage-locations.timeout.millis</name>
    <value>10000</value>
  </property>
  
  <property>
    <name>dfs.datanode.hdfs-blocks-metadata.enabled</name>
    <value>true</value>
  </property>

  <property>
    <name>dfs.datanode.max.transfer.threads</name>
    <value>4096</value>
  </property>

  <property>
    <name>fs.permissions.umask-mode</name>
    <value>{{ fs_permissions_umask }}</value>
  </property>
 <!--
 <property>
   <name>dfs.namenode.rpc-bind-host</name>
   <value>0.0.0.0</value>
 </property>
-->

</configuration>
